package com.muyu.day4zy.controller;

import com.muyu.day4zy.domain.Goods;
import com.muyu.day4zy.domain.Sku;
import com.muyu.day4zy.domain.req.CalculateReq;
import com.muyu.day4zy.domain.result.Result;
import com.muyu.day4zy.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName GoodsController
 * @Description 描述
 * @Author ShiYu.Cui
 * @Date 2024/3/25 19:59
 */
@RestController
public class GoodsController {
    @Autowired
    private GoodsService goodsService;
    @GetMapping("/goodsList")
    public Result<List<Goods>> goodsList(){
        return goodsService.goodsList();
    }
    @GetMapping("skuList")
    public Result<List<Sku>> skuList(@RequestParam Integer id){
        return goodsService.skuList(id);
    }

    @PostMapping("/calculate")
    public Result calculate(@RequestBody CalculateReq calculateReq){
        return goodsService.calculate(calculateReq);
    }
}
